import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { MeasureVO, MeasureForm, MeasureQuery } from '@/api/system/measure/types';

/**
 * 查询管控措施列表
 * @param query
 * @returns {*}
 */

export const listMeasure = (query?: MeasureQuery): AxiosPromise<MeasureVO[]> => {
  return request({
    url: '/system/measure/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询管控措施详细
 * @param id
 */
export const getMeasure = (id: string | number): AxiosPromise<MeasureVO> => {
  return request({
    url: '/system/measure/' + id,
    method: 'get'
  });
};

/**
 * 新增管控措施
 * @param data
 */
export const addMeasure = (data: MeasureForm) => {
  return request({
    url: '/system/measure',
    method: 'post',
    data: data
  });
};

/**
 * 修改管控措施
 * @param data
 */
export const updateMeasure = (data: MeasureForm) => {
  return request({
    url: '/system/measure',
    method: 'put',
    data: data
  });
};

/**
 * 删除管控措施
 * @param id
 */
export const delMeasure = (id: string | number | Array<string | number>) => {
  return request({
    url: '/system/measure/' + id,
    method: 'delete'
  });
};
